#include"consumer.hh"
#include"Task_queue.hh"
#include<stdlib.h>
#include<iostream>
#include<thread>
#include<chrono>
#include<mutex>

using std::cout;
using std::endl;
using std::this_thread::sleep_for;

//加锁输出需要给与两个参数,其中一个就是main函数里面定义的锁
void Consumer::get_asset(Taskqueue& rhs)
{
    
    for(int i=0 ;i<20;++i)
    {
       int ret= rhs.pop();
        //加锁输出

        cout<<">> get asset = ";
        sleep_for(std::chrono::seconds(1));
        cout<<ret<<endl;
    }
}
